function drawhistFromCoef(img_coef, type, T)
    % DRAWHISTFROMCOEF  draw DCT-coff histgram.
    % DRAWHISTFROMCOEF(IMG_COEF, T) draws image's DCT-coef distribution.
    % where IMG_COEF is DCT-coef matrix, and T is the range.
    % TYPE is one of the following value
    %   'hist'   : 1D histogram.
    %   'markov' : Difference DCT markov.
    switch type
        case 'hist'
            if nargin < 3
                T = 10;
            end
            h = generateHist(img_coef, T);
            drawHist1D(h, T);
        case 'markov'
            if nargin < 3
                T = 4;
            end
            h = generateDiff2DHist(img_coef, T);
            drawhist2D(h, T);
        otherwise
            error('unknown type')
    end
end
